{% extends "base.html" %}
{% block mystyles %}
    <style>
        html, body {
        {#background-image: url('/static/image/index.jpeg')  ;#} background-attachment: fixed;
            background-size: 100% 100%;
        {#overflow:hidden;#}{#width: 100%;#}{#height: 100%;#}{#margin: 0px;#}

        }
    </style>

{% endblock %}
{% block left_content %}
    <div class="panel panel-default">
        <div class="panel-heading"><span style="color: blue;font-weight: bold">流程</span></div>
        <div class="panel-body">
            <ul class="nav nav-pills nav-stacked ">
                <li  class="active">
                    <a href="#my_flow" data-toggle="tab">我的流程</a>
                </li>
                {% if current_user.account == 'admin' %}
                    <li >
                        <a href="#all_flow" data-toggle="tab">所有流程</a>
                    </li>
                {% endif %}

            </ul>
            {#            <div class="panel-footer">Panel footer</div>#}
        </div>
    </div>
{% endblock %}

{% block main_content %}
    <div class="tab-content vertical-tab-content">
        <div role="tabpanel" class="tab-pane active" id="my_flow">
            {% if user_flows %}

                <table class="table table-bordered" style="width: 100%">
                    <thead>
                    <tr>
                        <th>ID</th>
                        <th>流程类别</th>
                        <th>流程名称</th>
                        <th>启用状态</th>
                        <th>创建日期</th>
                        <th></th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for item in user_flows %}
                        <tr>
                            <td>{{ item.fid }}</td>
                            <td>{{ item.category }}</td>
                            <td>{{ item.name }}</td>
                            <td>{% if item.enabled %} 是 {% else %}否{% endif %}</td>
                            <td>{{ item.create_date }}</td>
                            <td>
                                {% if item.enabled %}
                                <a href="/flow/create_form/{{ item.fid }}"><i class="fa fa-paper-plane" ></i></a>
                                {% else %}
                                <i class="fa fa-close fa-2x" ></i>
                                {% endif %}
                            </td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>

            {% else %}
                <div class="jumbotron">
                    <h3>没有数据</h3>
                    <p>&nbsp;</p>
                    {#                <p><a class="btn btn-primary btn" href="/car_form/None" role="button">去添加</a></p>#}
                </div>
            {% endif %}
        </div>
        {% if current_user.account == 'admin' %}
            <div role="tabpanel" class="tab-pane" id="all_flow">
                {% if all_flows %}

                    <table class="table table-bordered" style="width: 100%">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>流程类别</th>
                            <th>流程名称</th>
                            <th>流程图</th>
                            <th>启用状态</th>
                            <th>创建日期</th>
                        </tr>
                        </thead>
                        <tbody>
                        {% for item in all_flows %}
                            <tr>
                                <td><a href="/flow/flow_config/{{ item.fid }}">{{ item.fid }}</a></td>
                                <td>{{ item.category }}</td>
                                <td>{{ item.name }}</td>

                            <td>   <a href="/flow/flow_chart/{{ item.fid }}" target="_blank"><span class="fa fa-sitemap fa-1x"></span></a></td>
                                <td>{% if item.enabled %} 是 {% else %}否{% endif %}</td>
                                <td>{{ item.create_date }}</td>
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>

                {% else %}
                    <div class="jumbotron">
                        <h3>没有数据</h3>
                        <p>&nbsp;</p>
                        {#                <p><a class="btn btn-primary btn" href="/car_form/None" role="button">去添加</a></p>#}
                    </div>
                {% endif %}
            </div>
        {% endif %}
    </div>

{% endblock %}